<style>
    .layui-form-label {
        width: 120px;
    }

    .layui-input-block {
        margin-left: 150px;
    }
</style>
<div class="rightcontent rc-bg-grey">
    <div class="rc-pagepadding">

        <div class=" rc-pannel ">
            <div class="rc-pannel-body layui-form">

                <div class="layui-tab layui-tab-brief">

                    <ul class="layui-tab-title">
                        <li class="layui-this">用户中心相关</li>
                        <li class="">上传设置</li>
                        <li class="">安全配置</li>
                    </ul>

                    <div class="layui-tab-content">

                        <div class="layui-tab-item layui-show rc-pagepadding">
                            <form class="layui-form" action="">

                                <div class="layui-form-item">
                                    <label class="layui-form-label">启用用户中心</label>
                                    <div class="layui-input-block">
                                        <input type="radio" autocomplete="off" <?php echo isset($ucentercnf['enableuc']) && $ucentercnf['enableuc'] == 1 ? 'checked' : '' ?> name="enableuc" lay-verify="required" value="1" class="layui-input" title="是" lay-filter="enableuc">
                                        <input type="radio" autocomplete="off" <?php echo isset($ucentercnf['enableuc']) && $ucentercnf['enableuc'] == -1 ? 'checked' : '' ?> name="enableuc" lay-verify="required" value="-1" class="layui-input" title="否" lay-filter="enableuc">
                                    </div>
                                </div>


                                <div class="layui-form-item">
                                    <label class="layui-form-label">登录页标题 <i class="layui-icon layui-icon-question rc-tips rc-pointer" message="可能会搭建一个多站点的集群系统，用户中心共用，这里可以单独为登录窗口起一个通用的名称"></i></label>
                                    <div class="layui-input-block">
                                        <input type="text" name="logintitle" value="<?php echo isset($ucentercnf['logintitle']) ? $ucentercnf['logintitle'] : '' ?>" class="layui-input">

                                    </div>
                                </div>

                                <div class="layui-form-item">
                                    <label class="layui-form-label">登录注册右侧图</label>
                                    <div class="layui-input-block">

                                        <?php
                                        echo element('singleimage', name: 'welcomepic', value: isset($ucentercnf['welcomepic']) ? $ucentercnf['welcomepic'] : '');
                                        ?>

                                    </div>
                                </div>




                                <div class="layui-form-item">
                                    <label class="layui-form-label">用户中心标题 <i class="layui-icon layui-icon-question rc-tips rc-pointer" message="可能会搭建一个多站点的集群系统，用户中心共用，这里可以单独为登录窗口起一个通用的名称"></i></label>
                                    <div class="layui-input-block">
                                        <input type="text" name="ucentertitle" value="<?php echo isset($ucentercnf['ucentertitle']) ? $ucentercnf['ucentertitle'] : '' ?>" class="layui-input">

                                    </div>
                                </div>


                                <div class="layui-form-item">
                                    <label class="layui-form-label">用户中心LOGO <i class="layui-icon layui-icon-question rc-tips rc-pointer" message="可能会搭建一个多站点的集群系统，用户中心共用，这里可以单独为登录窗口起一个通用的名称"></i></label>
                                    <div class="layui-input-block">

                                        <?php
                                        echo element('singleimage', name: 'ucenterlogo', value: isset($ucentercnf['ucenterlogo']) ? $ucentercnf['ucenterlogo'] : '');
                                        ?>

                                    </div>
                                </div>



                                <div class="layui-form-item">
                                    <label class="layui-form-label">自定义首页布局</label>
                                    <div class="layui-input-block">
                                        <a class="primary" href="/uc/Index/index?layout=layout" target="_blank" style="line-height: 30px;">立即去设计</a>
                                    </div>
                                </div>




                                <div class="layui-form-item rc-margin-bottom0">
                                    <div class="layui-input-block">
                                        <button type="button" class="layui-btn layui-btn-primary layui-btn-sm" lay-submit lay-filter="ucentercnf">提交</button>
                                        <button type="reset" class="layui-btn layui-btn-sm">重置</button>
                                    </div>
                                </div>
                            </form>
                        </div>
                        <div class="layui-tab-item rc-pagepadding">

                            <form class="layui-form" action="">
                                <div class="layui-form-item">
                                    <label class="layui-form-label">图片类型</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="imageext" id="imageext" lay-verify="required" class="layui-input" value="<?php echo isset($uploadcnf['imageext']) ? $uploadcnf['imageext'] : '.jpg,.gif,.png' ?>">
                                    </div>
                                </div>

                                <div class="layui-form-item">
                                    <label class="layui-form-label">图片大小限制</label>
                                    <div class="layui-input-inline layui-input-wrap">
                                        <input type="text" name="imagesize" id="imagesize" value="<?php echo isset($uploadcnf['imagesize']) ? $uploadcnf['imagesize'] : '20' ?>" lay-verify="required" placeholder="请输入" autocomplete="off" class="layui-input">
                                    </div>
                                    <div class="layui-form-mid layui-text-em">M</div>
                                </div>


                                <div class="layui-form-item">
                                    <label class="layui-form-label">附件类型</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="attachext" id="attachext" class="layui-input" value="<?php echo isset($uploadcnf['attachext']) ? $uploadcnf['attachext'] : '.zip,.xlsx,.xls,.rar,.doc,.docx' ?>">
                                    </div>
                                </div>


                                <div class="layui-form-item">
                                    <label class="layui-form-label">附件大小限制</label>
                                    <div class="layui-input-block">
                                        <div class="layui-input-inline layui-input-wrap">
                                            <input type="text" name="attachsize" id="attachsize" value="<?php echo isset($uploadcnf['attachsize']) ? $uploadcnf['attachsize'] : '100' ?>" lay-verify="required|pass" placeholder="请输入" autocomplete="off" class="layui-input">
                                        </div>
                                        <div class="layui-form-mid layui-text-em">M</div>
                                    </div>
                                </div>



                                <div class="layui-form-item rc-margin-bottom0">
                                    <div class="layui-input-block">
                                        <button type="button" class="layui-btn layui-btn-primary layui-btn-sm" lay-submit lay-filter="saveupload">提交</button>
                                        <button type="reset" class="layui-btn layui-btn-sm">重置</button>
                                    </div>
                                </div>
                            </form>

                        </div>

                        <div class="layui-tab-item rc-pagepadding">

                            <form class="layui-form" action="">

                                <div class="layui-form-item">
                                    <label class="layui-form-label">后台登录白名单</label>
                                    <div class="layui-input-block">
                                        <textarea class="layui-textarea" name="whitelist" placeholder="输入IP,多个IP用逗号隔开，只允许白名单内的IP可以访问后台"><?php echo isset($savecnf['whitelist']) ? $savecnf['whitelist'] : '' ?></textarea>
                                    </div>
                                </div>

                                <div class="layui-form-item">
                                    <label class="layui-form-label">后台登录黑名单</label>
                                    <div class="layui-input-block">
                                        <textarea class="layui-textarea" name="blacklist" placeholder="输入IP,多个IP用逗号隔开，禁止黑名单内的IP访问后台"><?php echo isset($savecnf['blacklist']) ? $savecnf['blacklist'] : '' ?></textarea>
                                    </div>
                                </div>




                                <div class="layui-form-item">

                                    <div class="layui-inline">

                                        <label class="layui-form-label">登录失败次数</label>

                                        <div class="layui-input-inline">
                                            <div class="layui-input-group">
                                                <div class="layui-input-split layui-input-prefix">
                                                    错误
                                                </div>

                                                <input type="text" name="loginerrcount" placeholder="输入错误次数" class="layui-input" value="<?php echo isset($savecnf['loginerrcount']) ? $savecnf['loginerrcount'] : '0' ?>">
                                                <div class="layui-input-split layui-input-suffix">
                                                    次
                                                </div>

                                            </div>


                                        </div>

                                    </div>

                                    <div class="layui-inline">
                                        <div class="layui-input-group">
                                            <div class="layui-input-split layui-input-prefix">
                                                限制
                                            </div>

                                            <input type="text" name="disablelogintime" value="<?php echo isset($savecnf['disablelogintime']) ? $savecnf['disablelogintime'] : '0' ?>" placeholder="多少分钟内禁止登录" class="layui-input">
                                            <div class="layui-input-split layui-input-suffix">
                                                分钟
                                            </div>
                                        </div>
                                    </div>
                                </div>


                                <div class="layui-form-item rc-margin-bottom0">
                                    <div class="layui-input-block">
                                        <button type="button" class="layui-btn layui-btn-primary layui-btn-sm" lay-submit lay-filter="savecnf">提交</button>
                                        <button type="reset" class="layui-btn layui-btn-sm">重置</button>
                                    </div>
                                </div>

                            </form>
                        </div>

                    </div>

                </div>

            </div>


        </div>

    </div>
</div>


<script>
    layui.use(function() {

        var layer = layui.layer;
        var form = layui.form;
        form.on('submit(saveupload)', function(data) {
            var data = data.field;
            $.ajax({
                url: '/admin/cnf/Syscnf/setUpload', //请求路径
                type: "POST", //请求方式
                data: data, // 默认写法
                success: function(data) {
                    if (data.code == 0) {
                        toastr_success("设置成功", function() {});
                    } else {
                        toastr_error(data.message);
                    }
                },
                error: function() {

                },

            });
        });

        form.on('submit(ucentercnf)', function(data) {
            var data = data.field;
            delete(data.ucenterlogo_file);
            delete(data.welcomepic_file);
            $.ajax({
                url: '/admin/cnf/Syscnf/setUcenter', //请求路径
                type: "POST", //请求方式
                data: data, // 默认写法
                success: function(data) {
                    if (data.code == 0) {
                        toastr_success("设置成功", function() {});
                    } else {
                        toastr_error(data.message);
                    }
                },
                error: function() {

                },

            });
        });
        form.on('submit(savecnf)', function(data) {
            var data = data.field;
            $.ajax({
                url: '/admin/cnf/Syscnf/setSave', //请求路径
                type: "POST", //请求方式
                data: data, // 默认写法
                success: function(data) {
                    if (data.code == 0) {
                        toastr_success("设置成功", function() {});
                    } else {
                        toastr_error(data.message);
                    }
                },
                error: function() {

                },

            });
        });


    });
</script>